<template>
  <el-input
    v-model="value"
    type="textarea"
    :rows="rows"
    placeholder="请输入内容"
    :maxlength="maxlength"
    show-word-limit
    :readonly="readonly"
    @input="inputChange"
  />
</template>

<script>
export default {
  name: 'Index',
  props: {
    readonly: {
      type: Boolean,
      default: false
    },
    remark: { // 内容
      type: String,
      default() {
        return ''
      }
    },
    rows: { // 框行数
      type: Number,
      default() {
        return 1
      }
    },
    maxlength: { // 最大输入长度
      type: Number,
      default() {
        return 10
      }
    }
  },
  data() {
    return {
      value: ''
    }
  },
  watch: {
    remark(e) {
      if (e) {
        this.value = e
      }
    }
  },
  methods: {
    inputChange(e) {
      this.$emit('getRemark', e)
    }
  }
}
</script>

